function drawBg() {
	ctx2.save();
	ctx2.fillStyle = "#6d8b6f";
	ctx2.fillRect(0, 0, 320, 480);
	ctx2.fillStyle = "#8bac8f";
	ctx2.fillRect(6, 36, 210, 420);

	ctx2.rect(250,230,30,200);
	ctx2.strokeStyle = "#eaf2bc";
	ctx2.stroke();

	ctx2.drawImage(levelIMG, 238, 140);
	ctx2.drawImage(scoreIMG, 235, 435);

	ctx2.drawImage(levelgrids,222,170);
	ctx2.drawImage(nextBG,225,35);

	//bgwY +=2 ;
	
	//getBgwArr();

	ctx2.drawImage(gridIMG, 5, 35);
	ctx2.restore();

}

function getBgwArr() {
	ctx2.save();
	ctx2.shadowColor = "white";
	ctx2.shadowBlur = 20;

	for (var i = 0; i < 5; i++) {
		bgw[i] = new Array();
		for (var j = 0; j < 9; j++) {
			bgw[i][j] = Math.round(Math.random());
			if (bgw[i][j] == 1) {
				ctx2.fillStyle = bgwcolor();
				ctx2.fillRect(bgwX + i * 65, bgwY + j * 65, 55, 55);
			}
		}
	}

	ctx2.restore();

};

function bgwcolor() {
	var n = Math.floor(Math.random() * 4);
	var arr = ["rgba(234,243,188,0.1)", "rgba(250,209,217,0.1)", "rgba(138,211,200,0.1)", "rgba(152,192,217,0.1)"];
	return arr[n];
}

function bgwArr(){
	for (var i = 0; i < 5; i++) {
		bgw[i] = new Array();
		for (var j = 0; j < 9; j++) {
			bgw[i][j] = bgwObj();
			bgw[i][j].x = bgwX+65*i;
			bgw[i][j].y = bgwY+65*j;
			if (bgw[i][j].num == 1) {
				ctx2.fillStyle = bgw[i][j].col;
				ctx2.fillRect(bgw[i][j].x,bgw[i][j].y, 55, 55);
			}
		}
	}
	
}

function bgwObj(){
	this.x = 0; 
	this.y = 0; 
	this.col = bgwcolor();
	this.num = Math.round(Math.random());
}
